<!--import -->
<!--这里用了个应对无法加载图片的函数 ？-->
<template>
  <div class="list1BOX">
    <!-- 单个 -->
    <div class="list1Content">
      <div class="songName a" style="font-weight: 600">歌曲名</div>
      <div class="albumName a" style="font-weight: 600">专辑名</div>
      <div class="time a" style="font-weight: 600">时长</div>
    </div>
    <div
      class="list1Content"
      v-for="(item1, index) in list1Content"
      :key="index"
    >
      <div class="songName a">{{ item1.name }}</div>
      <div class="albumName a">{{ item1.album }}</div>
      <div class="time a">{{ item1.time }}</div>
      <div class="list1_btn1" @click="toPlayPage(index)">
        <img
          :src="btn1"
          style="width: 22px; height: 22px"
          @error="imgOnerror($event)"
          alt=""
        />
      </div>
      <!-- <div class="list1_btn2">
        <img
          :src="btn2"
          style="width: 14px; height: 19px"
          @error="imgOnerror($event)"
          alt=""
        />
      </div> -->
    </div>
  </div>
</template>
<script>
export default {
  name: "",
  props: {
    list1Content: Array,
  },

  data() {
    return {
      btn1: require("../../assets/play.png"),
      btn2: require("../../assets/collect.png"),
    };
  },
  methods: {
    imgOnerror(event) {
      let img = event.srcElement;
      //   img.src = this.defaultImg
      img.onerror = null; // 防止闪图
    },
    toPlayPage(index) {
      this.$router.push({
        path: "/play_page",
        query: {
          flag: 4,
          songId: this.list1Content[index].id,
          userId: this.$parent.userID,
        },
      });
    },
  },
};
</script>
<style scoped>
.list1BOX {
  width: 1196px;
  height: 459px;
  overflow: hidden;
  border: 4px solid #21262c;
}
.list1Content {
  width: 1192px;
  height: 50px;
  display: flex;
  align-items: center;

  font-size: 18px;
  font-family: Microsoft YaHei UI;
  /* font-weight: 300; */
  color: #21262c;
  /* line-height: 66px; */
  /* background: #FFFFFF; */
}
.songName {
  margin-left: 108px;
  width: 280px;
  font-size: 18px;
  font-family: Microsoft YaHei UI;
  font-weight: 300;
  color: #21262c;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.albumName {
  width: 344px;
  font-size: 18px;
  font-family: Microsoft YaHei UI;
  font-weight: 300;
  color: #21262c;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.time {
  margin-right: 160px;
  width: 45px;
  font-size: 18px;
  font-family: Microsoft YaHei UI;
  font-weight: 300;
  color: #21262c;
}
.list1_btn1:hover {
    cursor: pointer;
} 
.list1_btn1:hover img{
  transform: scale(1.1);
}
.list1_btn1 img{
transition: all 0.3s;
}

.list1_btn2 {
  margin: 0 200px 0 23px;
}

/* 前面就是你选择的子代？ */
.list1Content:nth-child(even) {
  background-color: #fff;
}
/* odd 奇数 */
.list1Content:nth-child(odd) {
  background-color: #efefef;
}
/* even 偶数 */
</style>
